{% extends 'sims/base.html' %}

{% block title %}
    待办事项
{% endblock %}

{% block description %}
    待办事项
{% endblock %}

{% block navbar_top %}
    <a class="nav-item nav-link active" href="{% url 'sims:schedule' %}">待办事项</a>
{% endblock %}

{% block body_content %}
    <!-- 提示信息 -->
    {% if message_success %}
        <h5 class="page-header" style="margin-top: 20px"></h5>
        <div class="alert alert-success alert-dismissible fade show" role="alert">
            <strong>{{ message_success }}</strong>
            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
        </div>
    {% elif message_warn %}
        <h5 class="page-header" style="margin-top: 20px"></h5>
        <div class="alert alert-success alert-dismissible fade show" role="alert">
            <strong>{{ message_warn }}</strong>
            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
        </div>
    {% endif %}
    <div class="row">
        <div class="col-8 px-0">
            {% if thing_wait %}
                <table class="table table-hover">
                    <thead class="thead-light">
                    <tr>
                        <th scope="col">#</th>
                        <th scope="col">日程标题</th>
                        <th scope="col">日程内容</th>
                        <th scope="col">重要程度</th>
                        <th scope="col">结束时间</th>
                        <th scope="col">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for foo in thing_wait %}
                        <form action="/to_do/" method="POST">
                            {% csrf_token %}
                            <tr>
                                <th scope="row">{{ forloop.counter }}</th>
                                <th>{{ foo.title }}</th>
                                <th>{{ foo.content }}</th>
                                <th>{{ foo.important_level }}</th>
                                <th>{{ foo.end_date }}</th>
                                <th>
                                    {#                        <input type="submit" value="{{ foo.title }}" name="input">#}
                                    <button type="submit" class="btn btn-success" value="{{ foo.title }}"
                                            name="finished">完成
                                    </button>
                                </th>
                            </tr>
                        </form>
                    {% endfor %}
                    </tbody>
                </table>
            {% else %}
                <p>暂无待处理日程</p>
            {% endif %}

        </div>
        <div class="col-4">
            <div class="jumbotron">
                <h1 class="display-5">总览</h1>
                <p class="lead">您一共有{{ user_item.thing_wait }}件日程待处理, 其中</p>
                <h5 class="page-header" style="margin-top: 35px"></h5>
                <p class="lead">重要的日程: {{ thing_important }}</p>
                <h5 class="page-header" style="margin-top: 35px"></h5>
                <p class="lead">一般性的日程: {{ thing_common }}</p>
                <h5 class="page-header" style="margin-top: 35px"></h5>
                <p class="lead">不重要的日程: {{ thing_unimportant }}</p>
                <h5 class="page-header" style="margin-top: 35px"></h5>
                <hr class="my-4">
                <p>明日复明日，</p>
                <p>明日何其多，</p>
                <p>我生待明日，</p>
                <p>万事成蹉跎。</p>
                <p>——文嘉《明日歌》</p>
            </div>
        </div>
    </div>
{% endblock %}

{% block navbar_left %}
    <div class="navbar-nav">
        <a class="nav-item nav-link" href="{% url 'sims:index' %}">主页</a>
        <a class="nav-item nav-link" href="{% url 'sims:schedule' %}">日程安排</a>
        <a class="nav-item nav-link active" href="{% url 'sims:to_do' %}">待办事项</a>
        <a class="nav-item nav-link" href="{% url 'sims:history' %}">历史活动</a>
        <a class="nav-item nav-link" href="{% url 'sims:user_control' %}">个人中心</a>
    </div>
{% endblock %}